package com.xiaodao.beanlife;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.BeanFactoryAware;
import org.springframework.beans.factory.BeanNameAware;
import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.context.EnvironmentAware;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;

/**
 * Created by xiaodao
 * date: 2020/4/1
 */
@Component
public class LifeBean implements BeanNameAware , BeanFactoryAware, EnvironmentAware, BeanPostProcessor {
	@Override
	public void setBeanName(String name) {

		System.out.println(name);
	}

	@Override
	public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
		System.out.println(beanFactory.getBean("lifeBean"));
	}

	@Override
	public void setEnvironment(Environment environment) {
		System.out.println("LifeBean.setEnvironment");
	}

	@Override
	public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
		return null;
	}
}
